home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / fileutil / fileutils-3.16.tar.gz / fileutils-3.16.tar / fileutils-3.16 / m4 / progtest.m4 < prev    next >
Text File  |  1996-12-20  |  1KB  |  43 lines

  1. # Search path for a program which passes the given test.
  2. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  3.  
  4. # serial 1
  5.  
  6. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
  7. dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  8. AC_DEFUN(AM_PATH_PROG_WITH_TEST,
  9. [# Extract the first word of "$2", so it can be a program name with args.
  10. set dummy $2; ac_word=[$]2
  11. AC_MSG_CHECKING([for $ac_word])
  12. AC_CACHE_VAL(ac_cv_path_$1,
  13. [case "[$]$1" in
  14.   /*)
  15.   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  16.   ;;
  17.   *)
  18.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  19.   for ac_dir in ifelse([$5], , $PATH, [$5]); do
  20.     test -z "$ac_dir" && ac_dir=.
  21.     if test -f $ac_dir/$ac_word; then
  22.       if [$3]; then
  23.     ac_cv_path_$1="$ac_dir/$ac_word"
  24.     break
  25.       fi
  26.     fi
  27.   done
  28.   IFS="$ac_save_ifs"
  29. dnl If no 4th arg is given, leave the cache variable unset,
  30. dnl so AC_PATH_PROGS will keep looking.
  31. ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  32. ])dnl
  33.   ;;
  34. esac])dnl
  35. $1="$ac_cv_path_$1"
  36. if test -n "[$]$1"; then
  37.   AC_MSG_RESULT([$]$1)
  38. else
  39.   AC_MSG_RESULT(no)
  40. fi
  41. AC_SUBST($1)dnl
  42. ])
  43.